import scrapy
from tupianzj.items import TupianzjItem
from scrapy.http import Request

class MySpiderSpider(scrapy.Spider):
    name = 'my_spider'
    allowed_domains = ['tupianzj.com']
    start_urls = ['https://www.tupianzj.com/zhuangxiu/jianyue/']

    def parse(self, response):
        item = TupianzjItem()
        item['picurl'] = response.xpath('//ul[@class="list_con_box_ul"]//img/@src').extract()
        item['title'] = response.xpath('//ul[@class="list_con_box_ul"]//img/@alt').extract()
        yield item


        for i in range(2,47):
            nexturl = "https://www.tupianzj.com/zhuangxiu/jianyue/list_41_"+str(i)+".html"
            yield Request(nexturl,callback=self.parse)
